﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SelectDeposit.aspx.cs" Inherits="H2.NET.Web.Pages.SMD.SelectDeposit" %>

<script type="text/javascript">
    function SelectDepositAjaxDone(json) {
        if (json[DWZ.keys.statusCode] == DWZ.statusCode.ok) {
            window.open(json.navTabId);
            $.pdialog.closeCurrent();
        }
    }
    
    /* 根据区域初始化省份 */
    function initProvince(arg) {
        var val = $(arg).val();
        var id = $(arg).attr("id");
        if ($.trim(val)) {
            $.ajax({
                type: 'POST',
                url: '<%=Page.ResolveUrl("~/pages/smd/SelectChange.aspx?action=initProvince")%>',
                data: { ar: val, type: (id == "ddl_province" ? "province" : "city") },
                dataType: "json",
                cache: false,
                success: function (json) {
                    var rst = json.navTabId.split("|");
                    var html = "";
                    for (var i = 0; i < rst.length; i++) {
                        if (rst[i]) {
                            var list = rst[i].split(",");
                            html += "<option value='" + list[0] + "'>" + list[1] + "</option>";
                        }
                    }
                    if (id == "ddl_province") {
                        $("#ddl_cityName").find("option:gt(0)").remove().end().append(html);

                    }
                    else {
                        $("#ddl_province").find("option:gt(0)").remove().end().append(html);
                        $("#ddl_cityName").find("option:gt(0)").remove();
                    }
                }
            });
        }
        else {
            if (id == "ddl_province") {
                $("#ddl_cityName").find("option:gt(0)").remove();

            }
            else {
                $("#ddl_province").find("option:gt(0)").remove();
                $("#ddl_cityName").find("option:gt(0)").remove();
            }
        }
    }
</script>

<div class="pageContent">
    <form method="post" action="Pages/Smd/SelectDeposit.aspx?action=create&taskid=<%=TaskAPI.TaskID%>" class="pageForm required-validate" onsubmit="return validateCallback(this, SelectDepositAjaxDone);" runat="server">

        <div class="pageFormContent" layouth="50">
            
            <table class="formTable" style="">
                <tr>
                    <th>区域：</th>
                    <td><select id="ddl_region" runat="server" onchange="initProvince(this)" class="required"></select></td>
                </tr>
                <tr>
                    <th>省份：</th>
                    <td><select id="ddl_province" runat="server" class="required"></select></td>
                </tr>
                <tr>
                    <th>渠道：</th>
                    <td>
                        <select name="channel" class="required">
                            <option value="DULUX">多乐士</option>
                            <option value="LEVIS">来威</option>
                        </select>
                        <asp:hiddenfield ID="AutoBusinessKey" runat="server"></asp:hiddenfield>
                    </td>
                </tr>
            </table>
        </div>
        <div class="formBar">
            <ul>
                <li>
                    <div class="buttonActive">
                        <div class="buttonContent">
                            <button type="submit">确认选择</button></div>
                    </div>
                </li>
                <li>
                    <div class="button">
                        <div class="buttonContent">
                            <button type="button" class="close">关闭窗体</button></div>
                    </div>
                </li>
            </ul>
        </div>
    </form>
</div>